package com.rog.wir.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.i18n.client.Constants;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DecoratedTabPanel;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class MyFirstGWT implements EntryPoint {



	/**
	 * This is the entry point method.
	 */
	public void onModuleLoad() {
		
		DecoratedTabPanel tabPanel = new DecoratedTabPanel();
	    tabPanel.setWidth("400px");
	    tabPanel.setAnimationEnabled(true);

	    // Add a home tab
	    
	    
		
		
		
		
		Image img = new Image(
				"http://code.google.com/webtoolkit/logo-185x175.png");
		Button button = new Button("Click me");

		// We can add style names
		button.addStyleName("pc-template-btn");
		// or we can set an id on a specific element for styling
		img.getElement().setId("pc-template-img");

		VerticalPanel vPanel = new VerticalPanel();
		vPanel.setWidth("100%");
		vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
		vPanel.add(img);
		vPanel.add(button);

		// Add image and button to the RootPanel
		//

	    tabPanel.add(vPanel, "Home");	
	    
		VerticalPanel vPanel2 = new VerticalPanel();
		vPanel2.setWidth("100%");
		vPanel2.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
		vPanel2.add(img);

	    
	    
	    tabPanel.add(vPanel2, "GWT");	
	    tabPanel.selectTab(0);
	    
	    RootPanel.get().add(tabPanel);
		
		// Create the dialog box
		final DialogBox dialogBox = new DialogBox();
		dialogBox.setText("Welcome to GWT!");
		dialogBox.setAnimationEnabled(true);
		Button closeButton = new Button("close");
		VerticalPanel dialogVPanel = new VerticalPanel();
		dialogVPanel.setWidth("100%");
		dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
		dialogVPanel.add(closeButton);

		closeButton.addClickListener(new ClickListener() {
			public void onClick(Widget sender) {
				dialogBox.hide();
			}
		});

		// Set the contents of the Widget
		dialogBox.setWidget(dialogVPanel);

		button.addClickListener(new ClickListener() {
			public void onClick(Widget sender) {
				dialogBox.center();
				dialogBox.show();
			}
		});
	}
}
